<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/socket/internal/UdpSocket.cpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_9ad1227260954e346101f3844f0abb3d.html">socket</a></li><li class="navelem"><a class="el" href="dir_1865c4ce8b99f52bbeabfd52bfdd7cd3.html">internal</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">UdpSocket.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_udp_socket_8cpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_udp_socket_8h.html">UdpSocket.h</a>&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_sock_data_8h.html">SockData.h</a>&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a9fc6361330d621549ecf5b6431ae6aec">    6</a></span>&#160;<a class="code" href="class_c_udp_socket.html#a9fc6361330d621549ecf5b6431ae6aec">CUdpSocket::CUdpSocket</a>()</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;{</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;    <a class="code" href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">_Init</a>();</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;}</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a7534e19903201dd7be39029d52488f3e">   11</a></span>&#160;<a class="code" href="class_c_udp_socket.html#a9fc6361330d621549ecf5b6431ae6aec">CUdpSocket::CUdpSocket</a>(<a class="code" href="class_c_basic_service.html">CBasicService</a>* pServer)</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <a class="code" href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">_Init</a>();</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    <a class="code" href="class_c_socket.html#ad08fc2df680d1fd84035f5aada97dd3a">SetService</a>(pServer);</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;}</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#aeb84cc7c88f161ac7467dcc0a80b33e0">   17</a></span>&#160;<a class="code" href="class_c_udp_socket.html#aeb84cc7c88f161ac7467dcc0a80b33e0">CUdpSocket::~CUdpSocket</a>()</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;{</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;}</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#ifdef STD11</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<a class="code" href="class_c_udp_socket.html#a9fc6361330d621549ecf5b6431ae6aec">CUdpSocket::CUdpSocket</a>(<a class="code" href="class_c_udp_socket.html">CUdpSocket</a>&amp;&amp; sock)</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;{</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    *<span class="keyword">this</span> = std::move(sock);</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;}</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<a class="code" href="class_c_udp_socket.html">CUdpSocket</a>&amp; CUdpSocket::operator= (<a class="code" href="class_c_udp_socket.html">CUdpSocket</a>&amp;&amp; sock)</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;{</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keywordflow">if</span> (<span class="keyword">this</span> != &amp;sock)</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    {</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        <a class="code" href="class_c_socket.html#aa915ac02c07eed947bf2da35eacc3545">Close</a>();</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        <a class="code" href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">_Init</a>();</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        <a class="code" href="class_c_socket.html#a816347ac8821a8288a38645702bee10e">Swap</a>(sock);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    }</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;}</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">   41</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">CUdpSocket::_Init</a>()</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;{</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a> = <span class="keyword">new</span> <a class="code" href="struct_udp_socket_data.html">UdpSocketData</a>();</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#a62c02017570cd96f26a03cd06f4e4241">_sock</a> = <a class="code" href="tools_8h.html#a26769957ec1a2beaf223f33b66ee64ab">INVALID_SOCKET</a>;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#a96788b03903c266a6bc93a639c7ccb8e">_sockaddr</a>.<a class="code" href="class_c_sock_addr.html#ab7aaac6f7f95bf879555e9391acdd3d6">SetDomain</a>(<a class="code" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81a00bf55dcef9400794a5918a0fcd59b5d">SOCKFAMILY::IPV4</a>);</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#a4785e336958b99b727152864bcb6eb64">_type</a> = <a class="code" href="namespace_s_o_c_k_t_y_p_e.html#ab1b532206487defe92ed4eeae94b488ca6c4816da2ab72fec5773dc4650d5aa78">SOCKTYPE::DGRAM</a>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#ad15841c2a9a6343850b9c6885159a7f7">_protocol</a> = <a class="code" href="namespace_s_o_c_k_p_r_o_t_o_c_o_l.html#a6fcb9a12773185f3ca183ad967bb672ea58ac0a98fdbaa936244fd01553e71dce">SOCKPROTOCOL::UDP</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#aa0eb63e369865fb4ac2fde0bd0b98630">_pServerBuf</a>.<a class="code" href="class_shared_ptr.html#a0b0a4c8396bf40f91994f729855c0a5a">Reset</a>(NULL);</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>-&gt;<a class="code" href="struct_socket_data.html#a4ffff3c8536ece3b087e0ff5c4827b8e">_pServer</a> = <a class="code" href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a>;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.SetDomain(<a class="code" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81a00bf55dcef9400794a5918a0fcd59b5d">SOCKFAMILY::IPV4</a>);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a0ff35999590d434ec2ecd21e7a199789">   53</a></span>&#160;std::string <a class="code" href="class_c_udp_socket.html#a0ff35999590d434ec2ecd21e7a199789">CUdpSocket::GetRemoteAddr</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    std::string addr;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.GetAddr(addr);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a>(addr);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;}</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#ad33886caa477a9495a0d321b134ff857">   61</a></span>&#160;<a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> <a class="code" href="class_c_udp_socket.html#ad33886caa477a9495a0d321b134ff857">CUdpSocket::GetRemotePort</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keywordflow">return</span> dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.GetPort();</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;}</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a301f30c45f6f0c81b1b557ccf222f3e0">   66</a></span>&#160;<span class="keyword">const</span> <a class="code" href="class_c_sock_addr.html">CSockAddr</a>&amp; <a class="code" href="class_c_udp_socket.html#a301f30c45f6f0c81b1b557ccf222f3e0">CUdpSocket::GetRemoteSockaddr</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keywordflow">return</span> dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;}</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#ab8b1ed410724da2c2fa57e0e24ee9160">   71</a></span>&#160;<a class="code" href="class_c_sock_error.html">CSockError</a> <a class="code" href="class_c_udp_socket.html#ab8b1ed410724da2c2fa57e0e24ee9160">CUdpSocket::Socket</a>(<a class="code" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> domain <span class="comment">/* = SOCKFAMILY::IPV4 */</span>, <a class="code" href="namespace_s_o_c_k_t_y_p_e.html#ab1b532206487defe92ed4eeae94b488c">SOCKTYPE::SockType</a> type <span class="comment">/* = SOCKTYPE::DGRAM */</span>, </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="namespace_s_o_c_k_p_r_o_t_o_c_o_l.html#a6fcb9a12773185f3ca183ad967bb672e">SOCKPROTOCOL::SockProtocol</a> protocol <span class="comment">/* = SOCKPROTOCOL::UDP */</span>)</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;{</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_c_socket.html#af4c2b2c6e3696ba11c605ee6fead1736">CSocket::Socket</a>(domain, type, protocol);</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;}</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#a1c2fbd5b243f8b40d638731548aec11a">   77</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_socket.html#a1c2fbd5b243f8b40d638731548aec11a">CUdpSocket::SetRemoteAddr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* addr)</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;{</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.SetAddr(addr);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#ac3c2c759a303d3254c171c8373ac416d">   82</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_socket.html#ac3c2c759a303d3254c171c8373ac416d">CUdpSocket::SetRemotePort</a>(<a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> port)</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;{</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.SetPort(port);</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;}</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="class_c_udp_socket.html#af8aa3bdb55f59883197053e46ee9583f">   87</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_c_udp_socket.html#af8aa3bdb55f59883197053e46ee9583f">CUdpSocket::SetDomain</a>(<a class="code" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> domain)</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;{</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="class_c_socket.html#a8f9deafc91bedf6c25122fe98e8174d8">GetDomain</a>() != domain) </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    {</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        dynamic_cast&lt;UdpSocketData*&gt;(<a class="code" href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">_sockData</a>.<a class="code" href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">Get</a>())-&gt;_remoteSockaddr.SetDomain(domain);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <a class="code" href="class_c_socket.html#aafc3fc3ab0c1e3d5ae2cf9dfba46d442">CSocket::SetDomain</a>(domain);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;}</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclass_c_sock_error_html"><div class="ttname"><a href="class_c_sock_error.html">CSockError</a></div><div class="ttdoc">套接字错误信息类</div><div class="ttdef"><b>Definition:</b> <a href="_sock_error_8h_source.html#l00013">SockError.h:13</a></div></div>
<div class="ttc" id="atools_8h_html_a26769957ec1a2beaf223f33b66ee64ab"><div class="ttname"><a href="tools_8h.html#a26769957ec1a2beaf223f33b66ee64ab">INVALID_SOCKET</a></div><div class="ttdeci">#define INVALID_SOCKET</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00215">tools.h:215</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_ac3c2c759a303d3254c171c8373ac416d"><div class="ttname"><a href="class_c_udp_socket.html#ac3c2c759a303d3254c171c8373ac416d">CUdpSocket::SetRemotePort</a></div><div class="ttdeci">void SetRemotePort(DWORD port)</div><div class="ttdoc">设置远端端口</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00082">UdpSocket.cpp:82</a></div></div>
<div class="ttc" id="aclass_c_socket_html_aafc3fc3ab0c1e3d5ae2cf9dfba46d442"><div class="ttname"><a href="class_c_socket.html#aafc3fc3ab0c1e3d5ae2cf9dfba46d442">CSocket::SetDomain</a></div><div class="ttdeci">virtual void SetDomain(SOCKFAMILY::SockFamily domain=SOCKFAMILY::IPV4)</div><div class="ttdoc">设置协议族,注意重置该值将会清空地址、端口信息</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00181">Socket.cpp:181</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_t_y_p_e_html_ab1b532206487defe92ed4eeae94b488ca6c4816da2ab72fec5773dc4650d5aa78"><div class="ttname"><a href="namespace_s_o_c_k_t_y_p_e.html#ab1b532206487defe92ed4eeae94b488ca6c4816da2ab72fec5773dc4650d5aa78">SOCKTYPE::DGRAM</a></div><div class="ttdoc">socket 数据报,暂时不支持</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00048">SocketDef.h:48</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_a0ff35999590d434ec2ecd21e7a199789"><div class="ttname"><a href="class_c_udp_socket.html#a0ff35999590d434ec2ecd21e7a199789">CUdpSocket::GetRemoteAddr</a></div><div class="ttdeci">std::string GetRemoteAddr() const</div><div class="ttdoc">获取远程地址信息</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00053">UdpSocket.cpp:53</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html_a0f15d2d3d2834b0667791f3abfd9e0d7"><div class="ttname"><a href="class_shared_ptr.html#a0f15d2d3d2834b0667791f3abfd9e0d7">SharedPtr::Get</a></div><div class="ttdeci">Ty * Get()</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00202">SharedPtr.h:202</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_aeb84cc7c88f161ac7467dcc0a80b33e0"><div class="ttname"><a href="class_c_udp_socket.html#aeb84cc7c88f161ac7467dcc0a80b33e0">CUdpSocket::~CUdpSocket</a></div><div class="ttdeci">virtual ~CUdpSocket()</div><div class="ttdoc">析构函数释放资源</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00017">UdpSocket.cpp:17</a></div></div>
<div class="ttc" id="a_sock_data_8h_html"><div class="ttname"><a href="_sock_data_8h.html">SockData.h</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_p_r_o_t_o_c_o_l_html_a6fcb9a12773185f3ca183ad967bb672e"><div class="ttname"><a href="namespace_s_o_c_k_p_r_o_t_o_c_o_l.html#a6fcb9a12773185f3ca183ad967bb672e">SOCKPROTOCOL::SockProtocol</a></div><div class="ttdeci">SockProtocol</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00031">SocketDef.h:31</a></div></div>
<div class="ttc" id="a_udp_socket_8h_html"><div class="ttname"><a href="_udp_socket_8h.html">UdpSocket.h</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_t_y_p_e_html_ab1b532206487defe92ed4eeae94b488c"><div class="ttname"><a href="namespace_s_o_c_k_t_y_p_e.html#ab1b532206487defe92ed4eeae94b488c">SOCKTYPE::SockType</a></div><div class="ttdeci">SockType</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00045">SocketDef.h:45</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_a9fc6361330d621549ecf5b6431ae6aec"><div class="ttname"><a href="class_c_udp_socket.html#a9fc6361330d621549ecf5b6431ae6aec">CUdpSocket::CUdpSocket</a></div><div class="ttdeci">CUdpSocket()</div><div class="ttdoc">构造一个默认的upd套接字类</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00006">UdpSocket.cpp:6</a></div></div>
<div class="ttc" id="aclass_c_sock_addr_html"><div class="ttname"><a href="class_c_sock_addr.html">CSockAddr</a></div><div class="ttdoc">协议地址结构体</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8h_source.html#l00043">SockTools.h:43</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html"><div class="ttname"><a href="class_c_udp_socket.html">CUdpSocket</a></div><div class="ttdoc">udp套接口</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8h_source.html#l00010">UdpSocket.h:10</a></div></div>
<div class="ttc" id="aclass_c_socket_html_a816347ac8821a8288a38645702bee10e"><div class="ttname"><a href="class_c_socket.html#a816347ac8821a8288a38645702bee10e">CSocket::Swap</a></div><div class="ttdeci">virtual void Swap(CSocket &amp;sock)</div><div class="ttdoc">交换两个套接口类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00290">Socket.cpp:290</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_p_r_o_t_o_c_o_l_html_a6fcb9a12773185f3ca183ad967bb672ea58ac0a98fdbaa936244fd01553e71dce"><div class="ttname"><a href="namespace_s_o_c_k_p_r_o_t_o_c_o_l.html#a6fcb9a12773185f3ca183ad967bb672ea58ac0a98fdbaa936244fd01553e71dce">SOCKPROTOCOL::UDP</a></div><div class="ttdoc">udp协议</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00036">SocketDef.h:36</a></div></div>
<div class="ttc" id="aclass_c_socket_html_ad08fc2df680d1fd84035f5aada97dd3a"><div class="ttname"><a href="class_c_socket.html#ad08fc2df680d1fd84035f5aada97dd3a">CSocket::SetService</a></div><div class="ttdeci">virtual void SetService(CBasicService *service)</div><div class="ttdoc">关联相应的工作类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00047">Socket.cpp:47</a></div></div>
<div class="ttc" id="astruct_socket_data_html_a4ffff3c8536ece3b087e0ff5c4827b8e"><div class="ttname"><a href="struct_socket_data.html#a4ffff3c8536ece3b087e0ff5c4827b8e">SocketData::_pServer</a></div><div class="ttdeci">CBasicService * _pServer</div><div class="ttdoc">绑定的tcp服务基类</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00036">SockData.h:36</a></div></div>
<div class="ttc" id="aclass_c_sock_addr_html_ab7aaac6f7f95bf879555e9391acdd3d6"><div class="ttname"><a href="class_c_sock_addr.html#ab7aaac6f7f95bf879555e9391acdd3d6">CSockAddr::SetDomain</a></div><div class="ttdeci">void SetDomain(SOCKFAMILY::SockFamily domain)</div><div class="ttdoc">设置协议族</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8cpp_source.html#l00209">SockTools.cpp:209</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="astruct_socket_data_html_aa0eb63e369865fb4ac2fde0bd0b98630"><div class="ttname"><a href="struct_socket_data.html#aa0eb63e369865fb4ac2fde0bd0b98630">SocketData::_pServerBuf</a></div><div class="ttdeci">SharedPtr&lt; SockDataBuffer &gt; _pServerBuf</div><div class="ttdoc">内部使用</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00035">SockData.h:35</a></div></div>
<div class="ttc" id="astruct_socket_data_html_ad15841c2a9a6343850b9c6885159a7f7"><div class="ttname"><a href="struct_socket_data.html#ad15841c2a9a6343850b9c6885159a7f7">SocketData::_protocol</a></div><div class="ttdeci">SOCKPROTOCOL::SockProtocol _protocol</div><div class="ttdoc">套接字协议</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00033">SockData.h:33</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_a301f30c45f6f0c81b1b557ccf222f3e0"><div class="ttname"><a href="class_c_udp_socket.html#a301f30c45f6f0c81b1b557ccf222f3e0">CUdpSocket::GetRemoteSockaddr</a></div><div class="ttdeci">const CSockAddr &amp; GetRemoteSockaddr() const</div><div class="ttdoc">获取远程地址结构信息</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00066">UdpSocket.cpp:66</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html_a0b0a4c8396bf40f91994f729855c0a5a"><div class="ttname"><a href="class_shared_ptr.html#a0b0a4c8396bf40f91994f729855c0a5a">SharedPtr::Reset</a></div><div class="ttdeci">void Reset(Ty *p)</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00175">SharedPtr.h:175</a></div></div>
<div class="ttc" id="astruct_socket_data_html_a96788b03903c266a6bc93a639c7ccb8e"><div class="ttname"><a href="struct_socket_data.html#a96788b03903c266a6bc93a639c7ccb8e">SocketData::_sockaddr</a></div><div class="ttdeci">CSockAddr _sockaddr</div><div class="ttdoc">地址信息</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00034">SockData.h:34</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_ab8b1ed410724da2c2fa57e0e24ee9160"><div class="ttname"><a href="class_c_udp_socket.html#ab8b1ed410724da2c2fa57e0e24ee9160">CUdpSocket::Socket</a></div><div class="ttdeci">virtual CSockError Socket(SOCKFAMILY::SockFamily domain=SOCKFAMILY::IPV4, SOCKTYPE::SockType type=SOCKTYPE::DGRAM, SOCKPROTOCOL::SockProtocol protocol=SOCKPROTOCOL::UDP)</div><div class="ttdoc">初始化套接字</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00071">UdpSocket.cpp:71</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_a9c01deefea11a4b5f8e9f8a22f65dcea"><div class="ttname"><a href="class_c_udp_socket.html#a9c01deefea11a4b5f8e9f8a22f65dcea">CUdpSocket::_Init</a></div><div class="ttdeci">virtual void _Init()</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00041">UdpSocket.cpp:41</a></div></div>
<div class="ttc" id="atools_8h_html_a798af1e30bc65f319c1a246cecf59e39"><div class="ttname"><a href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a></div><div class="ttdeci">unsigned int DWORD</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00134">tools.h:134</a></div></div>
<div class="ttc" id="aclass_c_socket_html_aa915ac02c07eed947bf2da35eacc3545"><div class="ttname"><a href="class_c_socket.html#aa915ac02c07eed947bf2da35eacc3545">CSocket::Close</a></div><div class="ttdeci">virtual int Close()</div><div class="ttdoc">关闭套接字</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00107">Socket.cpp:107</a></div></div>
<div class="ttc" id="aclass_c_socket_html_a8f9deafc91bedf6c25122fe98e8174d8"><div class="ttname"><a href="class_c_socket.html#a8f9deafc91bedf6c25122fe98e8174d8">CSocket::GetDomain</a></div><div class="ttdeci">virtual SOCKFAMILY::SockFamily GetDomain() const</div><div class="ttdoc">获取协议族</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00198">Socket.cpp:198</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_ad33886caa477a9495a0d321b134ff857"><div class="ttname"><a href="class_c_udp_socket.html#ad33886caa477a9495a0d321b134ff857">CUdpSocket::GetRemotePort</a></div><div class="ttdeci">DWORD GetRemotePort() const</div><div class="ttdoc">获取远程端口信息</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00061">UdpSocket.cpp:61</a></div></div>
<div class="ttc" id="atools_8h_html_ab689500aaec0db066e3ac9483d3fe425"><div class="ttname"><a href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a></div><div class="ttdeci">#define NullPtr</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00119">tools.h:119</a></div></div>
<div class="ttc" id="astruct_socket_data_html_a62c02017570cd96f26a03cd06f4e4241"><div class="ttname"><a href="struct_socket_data.html#a62c02017570cd96f26a03cd06f4e4241">SocketData::_sock</a></div><div class="ttdeci">SOCKET _sock</div><div class="ttdoc">套接字</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00031">SockData.h:31</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_f_a_m_i_l_y_html_a2752d06098f227dbd8340b30a718da81a00bf55dcef9400794a5918a0fcd59b5d"><div class="ttname"><a href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81a00bf55dcef9400794a5918a0fcd59b5d">SOCKFAMILY::IPV4</a></div><div class="ttdoc">sockaddr_in</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00061">SocketDef.h:61</a></div></div>
<div class="ttc" id="atools_8h_html_acc6d8511211e23ff33647d261f6f8b59"><div class="ttname"><a href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a></div><div class="ttdeci">#define STD_MOVE(object)</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00043">tools.h:43</a></div></div>
<div class="ttc" id="aclass_c_socket_html_af4c2b2c6e3696ba11c605ee6fead1736"><div class="ttname"><a href="class_c_socket.html#af4c2b2c6e3696ba11c605ee6fead1736">CSocket::Socket</a></div><div class="ttdeci">virtual CSockError Socket(SOCKFAMILY::SockFamily domain=SOCKFAMILY::IPV4, SOCKTYPE::SockType type=SOCKTYPE::STREAM, SOCKPROTOCOL::SockProtocol protocol=SOCKPROTOCOL::TCP)</div><div class="ttdoc">初始化套接字</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8cpp_source.html#l00068">Socket.cpp:68</a></div></div>
<div class="ttc" id="aclass_c_socket_html_a16e8377c836739648ebd6df427232fa8"><div class="ttname"><a href="class_c_socket.html#a16e8377c836739648ebd6df427232fa8">CSocket::_sockData</a></div><div class="ttdeci">SharedPtr&lt; SocketData &gt; _sockData</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8h_source.html#l00155">Socket.h:155</a></div></div>
<div class="ttc" id="aclass_c_basic_service_html"><div class="ttname"><a href="class_c_basic_service.html">CBasicService</a></div><div class="ttdoc">服务类 基类</div><div class="ttdef"><b>Definition:</b> <a href="_service_base_8h_source.html#l00015">ServiceBase.h:15</a></div></div>
<div class="ttc" id="astruct_udp_socket_data_html"><div class="ttname"><a href="struct_udp_socket_data.html">UdpSocketData</a></div><div class="ttdoc">UDP专用套接口数据</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00053">SockData.h:53</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_af8aa3bdb55f59883197053e46ee9583f"><div class="ttname"><a href="class_c_udp_socket.html#af8aa3bdb55f59883197053e46ee9583f">CUdpSocket::SetDomain</a></div><div class="ttdeci">virtual void SetDomain(SOCKFAMILY::SockFamily domain)</div><div class="ttdoc">设置协议族</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00087">UdpSocket.cpp:87</a></div></div>
<div class="ttc" id="astruct_socket_data_html_a4785e336958b99b727152864bcb6eb64"><div class="ttname"><a href="struct_socket_data.html#a4785e336958b99b727152864bcb6eb64">SocketData::_type</a></div><div class="ttdeci">SOCKTYPE::SockType _type</div><div class="ttdoc">套接字类型</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00032">SockData.h:32</a></div></div>
<div class="ttc" id="aclass_c_udp_socket_html_a1c2fbd5b243f8b40d638731548aec11a"><div class="ttname"><a href="class_c_udp_socket.html#a1c2fbd5b243f8b40d638731548aec11a">CUdpSocket::SetRemoteAddr</a></div><div class="ttdeci">void SetRemoteAddr(const char *addr)</div><div class="ttdoc">设置远端地址</div><div class="ttdef"><b>Definition:</b> <a href="_udp_socket_8cpp_source.html#l00077">UdpSocket.cpp:77</a></div></div>
<div class="ttc" id="anamespace_s_o_c_k_f_a_m_i_l_y_html_a2752d06098f227dbd8340b30a718da81"><div class="ttname"><a href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a></div><div class="ttdeci">SockFamily</div><div class="ttdef"><b>Definition:</b> <a href="_socket_def_8h_source.html#l00057">SocketDef.h:57</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
